home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d889.lha / SCSIUtil / SCSIUtil.doc < prev    next >
Text File  |  1993-07-16  |  10KB  |  274 lines

  1. SCSIUtil - an utility for doing SCSI low level operations
  2.  
  3.  
  4. SCSIUtil (c) 1991,92,93 by Gary Duncan and Heiko Rath
  5.  
  6.  
  7.     Gary Duncan
  8.     Philips PTS
  9.     23 Lakeside Dr
  10.     Tally-Ho Technology Park
  11.     Burwood East Vic 3151
  12.     Australia
  13.  
  14.     EMail: gduncan@philips.oz.au
  15.  
  16.  
  17.     The Software Brewery
  18.     Heiko Rath
  19.     Raiffeisenstr.10a
  20.     D-6108 Weiterstadt    (after 1.July.1993: 64331 Weiterstadt)
  21.     Germany
  22.  
  23.     EMail: hr@brewhr.swb.de
  24.     Phone: +49 (6150) 2607  (CET!)
  25.  
  26.  
  27.  BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
  28.  FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT
  29.  WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
  30.  PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND,
  31.  EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
  32.  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  33.  PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
  34.  PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
  35.  THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  36.  
  37.  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  38.  WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
  39.  REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
  40.  DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
  41.  DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
  42.  (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
  43.  INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE
  44.  OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
  45.  HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
  46.  DAMAGES.
  47.  
  48.  The source is provided, therefore you can make changes yourself. The
  49.  only thing I'm asking is that if you do make changes, please get in
  50.  touch with me (hr@brewhr.swb.de), so that we can coordinate any
  51.  further development.
  52.  
  53.  
  54. What is SCSIUtil?
  55.  
  56.  It is a little utility to do some low level stuff with SCSI devices.
  57.  As I currently don't have the time to work on it (I'm working on my
  58.  thesis) I release it to the public as it is. It is far from being
  59.  perfect, but it is useful to me. In it's current incarnation it has
  60.  the following features:
  61.  
  62.   - read the capacity of a SCSI device
  63.   - read 16 bit raw digital audio off an audio CD (works with Sony CDU
  64.     561 & 8003) (left/right channel and stereo reading supported)
  65.   - read 16 bit raw digital audio off an audio CD and convert to 8 bit
  66.     (again left/right channel and stereo reading supported)
  67.   - eject/insert a medium via software control
  68.   - display the Inquiry data of a drive
  69.   - read & interpret a CD-ROM data block address header
  70.   - start/stop the motor on a device
  71.   - read pages via MODE SENSE
  72.   - play audio on a CD-ROM drive (tested with Sony CDU 561 = Apple CD-300)
  73.   - read sectors
  74.   - seek to a specified sector
  75.   - display table of contents (TOC) of a CD
  76.   - read subchannel information of a CD (tested with Sony CDU 561)
  77.  
  78.  
  79. Why SCSIUtil?
  80.  
  81.  I needed some software to explore my new CD-ROM drive.
  82.  
  83.  Here is what SCSIUtil displays, if you invoke it without parameters:
  84.  
  85.  SCSIutil V1.815beta [Jun 19 1993 : 21:10:56] - written by Gary Duncan
  86.           additional features by Heiko Rath, hr@brewhr.swb.de
  87.  Usage: SCSIutil [-dscsi_dev] <scsi_id> <command>
  88.   -c[r]               : Read capacity [raw]
  89.   -d<l|r|s> sec blks  : Read 16 bit raw digital audio(start sector/# blocks)(2)
  90.   -D<l|r> sec blks    : Read  8 bit raw digital audio(left or right channel)(3)
  91.   -e <0|1>            : Change medium (0=eject, 1=load)
  92.   -i[r]               : Inquiry [raw]
  93.   -h[r] blk           : Read CD-ROM data block address header
  94.   -m <0|1>            : Stop/Start motor {0=stop, 1=start}
  95.   -o[r] contr page    : Mode sense (contr = 0-3))
  96.   -p st si et ei      : Play audio CD track (1-99), index (1-99)
  97.   -r[t] sec_no        : Read sectors [use trackdisk.device]
  98.   -s sec_no           : Seek to sector (5)
  99.   -t[r|l]             : Display TOC of an audio CD [raw|long]
  100.   -u[r] chan fmt track: Read CD sub-channel information [raw] (6)
  101.  
  102.  Note 1: usually scsi_id = (BOARD * 100) + (LUN * 10) + SCSI_TARGET_ID
  103.       2: with 's' returns LRLRLR pairs of stereo audio, 2352 bytes per block
  104.       3: converted to 8 bit audio (-d and -D work with Sony CDU 561 & 8003)
  105.       4: contr 0: current, 1: changeable, 2: default, 3: saved values
  106.       5: to park heads, try sec_no of -1
  107.       6: Q-channel = 64, fmt: 0=Sub-Q Channel data,1=current CD-ROM pos.,
  108.          2=Media Catalog Number (UPC/Bar Code),3=Track ISRC
  109.  
  110.  
  111. Documentation on the options of SCSIUtil:
  112.  
  113.  -c[r]               : Read capacity [raw]
  114.  
  115.     This will issue a READ CAPACITY to the device to get the
  116.     highest sector available, the sector size and the capacity
  117.     (= sector size * max sector). With the 'r' option SCSIUtil
  118.     will not try to interpret the returned data.
  119.  
  120.     BTW, the Apple CD-300 returns different sector sizes,
  121.     depending on the last read size (that means sometimes it is
  122.     96, 2048 or 2352).
  123.  
  124.  -d<l|r|s> sec blks  : Read 16 bit raw digital audio(start sector/#blocks)(*2*)
  125.  
  126.     This will read data directly from the specified CD-ROM drive,
  127.     interpreting the information as raw digital input. A value for
  128.     the sector to start reading from is required as well as the
  129.     number of sectors to read. The data will be in 16-bit format
  130.     e.g.  SCSIutil 2 -ds 2 100 Reads the first 100 blocks starting
  131.     from sector 2 as Stereo 16 bit data. One sector corresponds to
  132.     1/75 of a second.  The data will be output to stdout.  This
  133.     works with the Sony CDU-541/561 (Apple uses the CDU-561 in
  134.     their Apple CD-300).
  135.  
  136.     The digital audio data sent to stdout looks like this:
  137.  
  138.     struct cdda_sector {
  139.       struct cdda_sample {
  140.         char left_channel_lsb;
  141.         char left_channel_msb;
  142.         char right_channel_lsb;
  143.         char right_channel_msb;
  144.       } samples[588];
  145.     };
  146.  
  147.     With mono, either the left or right channel is skipped.
  148.  
  149.     BEWARE: sometimes I get SCSI bus lockups while using this
  150.     command. I'm pretty sure that it's not SCSIUtil's fault, but
  151.     either a problem of the WD SCSI chip 33C93A 00-04-PROTO in my
  152.     Amiga 3000 or a firmware bug in the Apple CD-300 (my firmware
  153.     is release 1.8d). The lockups occur only if I read more than
  154.     about 150 sectors.
  155.  
  156.  -D<l|r> sec blks    : Read  8 bit raw digital audio(left or right channel)(*3*)
  157.  
  158.     Does basically the same as the '-d' option, only divides every
  159.     16 bit word by 256 before sending it to stdout, which makes
  160.     for a cheap (and suboptimal) conversion to 8 bit. The warning
  161.     about SCSI bus lockups applies also to this command.
  162.  
  163.  -e <0|1>            : Change medium (0=eject, 1=load)
  164.  
  165.     By using this command you can eject a removable medium via
  166.     software, e.g. SCSIutil 2 -e 0 ejects the CD-ROM currently in
  167.     the drive with SCSI id 2.
  168.  
  169.  -i[r]               : Inquiry [raw]
  170.  
  171.     This command sends the INQUIRY command to the specified
  172.     device. This can be used to get all kinds of information about
  173.     the device. With the 'r' parameter SCSIUtil will not try to
  174.     interpret the information returned.
  175.  
  176.  -h[r] blk           : Read CD-ROM data block address header
  177.  
  178.     This will read the address header information of a particular
  179.     CD-ROM block, e.g. SCSIutil 2 -h 100 reads block 100 from SCSI
  180.     device 2 and returns the header information.
  181.  
  182.  -m <0|1>            : Stop/Start motor {0=stop, 1=start}
  183.  
  184.     Start or stop the device motor of the specified device.
  185.     SCSIutil 2 -m 0 stops a CD that is playing in SCSI device 2.
  186.  
  187.  -o[r] contr page    : Mode sense (contr = 0-3)) (*4*)
  188.  
  189.     Reads MODE SENSE control pages from a SCSI device. The contr
  190.     parameter decides what pages to return:
  191.  
  192.     contr 0: current values
  193.               1: changeable values (not interpreted correctly by SCSIUtil)
  194.               2: default values
  195.               3: saved values
  196.  
  197.     The page value must be in the range of 0-63. Page 63 usually
  198.     returns all the available MODE SENSE pages.  With the 'r'
  199.     option SCSIUtil will not interpret the returned data.
  200.  
  201.  -p st si et ei      : Play audio CD track (1-99), index (1-99)
  202.  
  203.     Allows the playing of a series of audio tracks. Can use index
  204.     marks as well e.g. SCSIutil 2 -p 1 1 8 1 plays an Audio CD in
  205.     SCSI device 5 from Track 1 to Track 8.
  206.     Track and Index should be in the range of 1-99 (according to
  207.     the ANSI SCSI 2 specs). The Apple CD-300 accepts an index of 0
  208.     as play whole track, therefore I allowed the selection of 0 as
  209.     an index, even though the online help states otherwise. To
  210.     play a whole CD type: scsiutil 2 -p 1 0 99 0. To play only
  211.     track 3: scsiutil 2 -p 3 1 3 1.
  212.  
  213.  -r[t] sec_no        : Read sectors [use trackdisk.device]
  214.  
  215.     Read data sector off a SCSI device. In case of an audio CD use
  216.     the -d or -D commands to read digital audio data.
  217.  
  218.  -s sec_no           : Seek to sector (*5*)
  219.  
  220.     Seek the head of a device to the specified sector.
  221.  
  222.  -t[r|l]             : Display TOC of an audio CD [raw|long]
  223.  
  224.     Reads the table of contents of a CD. The TOC can contain
  225.     entries for data/audio tracks.  With the 'r' option SCSIUtil
  226.     won't interpret the returned data. With the 'l' option
  227.     SCSIUtil will display the TOC in a longer form.
  228.  
  229.  -u[r] chan fmt track: Read CD sub-channel information [raw] (*6*)
  230.  
  231.     Reads information from the specified sub-channel of a CD.
  232.  
  233.     Chan = 64 = Q-Sub-channel
  234.     Fmt 0: read Q-sub-channel
  235.      Doesn't work with the Apple CD-300 drive
  236.     Fmt 1: read current position data
  237.      Track must be 0
  238.     Fmt 2: read media catalog number (UPC/Bar Code)
  239.      Track must be 0
  240.     Fmt 3: read track international standard recording code (ISRC)
  241.      Track must be a valid track
  242.  
  243.     With the 'r' option SCSIUtil doesn't try to interpret the
  244.     returned data.
  245.  
  246.  
  247. The future:
  248.  
  249.  There are several things that I'd like to implement, take a look at
  250.  the TODO file. If you have a need for some additional features you
  251.  can always try to talk me into implementing them (hint: I can be
  252.  bribed ;-)
  253.  
  254.  
  255. Acknowledgements:
  256.  
  257.  Fred Fish for his work for the Amiga community
  258.  
  259.  Gary Duncan (gduncan@philips.oz.au) for having written the original
  260.     version and releasing the source to the public
  261.  
  262.  Dave Hassal (dave@ainfo.equinox.gen.nz) for bugging me with questions
  263.     and pushing me into finishing SCSIUtil.
  264.  
  265.  Ralph Babel for some hints/tips/tricks.
  266.  
  267.  Franz-Josef Reichert for his Jukebox.
  268.  
  269.  Free Software Foundation, Inc. for the no warranty text and use at
  270.     your own risk texts. Also thanks for some high quality SW.
  271.  
  272.  My fellow Software Brewers (Christian Balzer & Armin Sparr) for
  273.  support.
  274.